package com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.service;

import com.zz.ecommerce.common.constants.TableConstants;
import com.zz.ecommerce.togatherDeclareMgr.common.bean.TEntryInfo;
import com.zz.ecommerce.togatherDeclareMgr.common.dao.TEntryInfoDao;
import com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.bean.MsgDecHistory;
import com.zz.ecommerce.togatherDeclareMgr.custDeclarationUpload.dao.DecStatusDao;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <一句话功能描述>
 * <功能详细描述>
 *
 * @author Administrator
 * @date 2015/8/15,16:33
 */
@Service
public class DecStatusService {

    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private DecStatusDao decStatusDao;

    @Autowired
    private TEntryInfoDao entryInfoDao;

    @Transactional(readOnly = true)
    public List<MsgDecHistory> queryCustDecStatusList(MsgDecHistory msgDecHistory) {
        TEntryInfo entryInfo = new TEntryInfo();
        entryInfo.setConIndx(msgDecHistory.getClientSeqNo());
        msgDecHistory.setSeqNo(StringUtils.defaultString(queryEntryInfo(entryInfo).getEntryNo()));

        return decStatusDao.queryCustDecStatusList(msgDecHistory, " CREATE_TIME DESC");
    }

    @Transactional(readOnly = true)
    public TEntryInfo queryEntryInfo(TEntryInfo entryInfo) {
        return entryInfoDao.query(TableConstants.T_ENTRYINFO, entryInfo);
    }

}
